package pers.mihao.quickstream.common.util.biz;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @author mihao
 * @since 2023/3/7
 */
@Configuration
public class EnvironmentUtil {

    private static String ENV = "dev";

    private static String PROJECT_NAME = "spring";

    @Value("${spring.env.flag:dev}")
    private void setEnv(String env){
        ENV = env;
    }

    @Value("${project.name:spring}")
    private void setProjectName(String env){
        PROJECT_NAME = env;
    }

    public static boolean isDev(){
        return "dev".equals(ENV);
    }

    public static boolean isTest() {
        return "test".equals(ENV);
    }

    public static String getProjectName() {
        return PROJECT_NAME;
    }
}
